package com.winhxd.b2c.common.domain.order.enums;

/**
* @author hjw
* @date 2019/1/8 15:54
* @Description 订单状态枚举
*/
public enum OrderStatusEnum {
    /**
     * 待付款
     */
    WAIT_PAY(1, "待付款"),
    /**
     * 已取消
     */
    CANCELED( 2, "已取消"),
    /**
     * 待发货
     */
    WAIT_DELIVERING(3, "待发货"),
    /**
     * 待收货
     */
    WAIT_RECEIVING(4, "待收货"),
    /**
     * 已收货
     */
    RECEIVIED(5, "已收货"),
    /**
     * 已完成
     */
    FINISHED(6, "已完成"),
    /**
     * 已关闭
     */
    CLOSE(7, "已关闭");

    private int statusCode;
    private String statusDes;

    OrderStatusEnum(int statusCode, String statusDes) {
        this.statusCode = statusCode;
        this.statusDes = statusDes;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public String getStatusDes() {
        return statusDes;
    }

    public static String getDesByCode(int statusCode){
        String result="";
        for (int i=0;i<OrderStatusEnum.values().length;i++){
            if (OrderStatusEnum.values()[i].getStatusCode()==statusCode){
                result=OrderStatusEnum.values()[i].getStatusDes();
                break;
            }
        }
        return  result;
    }
}
